package com.static_;

/**
 * @Author 小闽
 * @Date 2024/9/5 22:30
 * @PackageName: com.static_
 * @ClassName: StaticExercise03
 * @Description: 练习3
 * @Version 1.0
 */
public class StaticExercise03 {
    public static void main(String[] args) {
        Person1.setTotalPerson(3); // total = 3
        Person1 person1 = new Person1();
        person1.m();

    }
}

class Person1 {
    private int id;
    private static int total = 0;
    public static void setTotalPerson(int total){
        Person1.total = total;
    }
    public static void m(){
        System.out.println("total的值为：" + total);
    }
    public Person1() {
        total++;
        id = total;
    }

}
